package cn.hill4j.tool.spring.std.mvcext.controller;

import cn.hill4j.tool.spring.ext.mvc.decrypt.RequestDec;
import cn.hill4j.tool.spring.ext.mvc.encryption.ResponseEnc;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/mvcext")
public class MvcExtController {
    @PostMapping("/enc")
    @ResponseEnc(encType = "encBody")
    public Map enc(@RequestBody Map data){
        return data;
    }
    @PostMapping("dec")
    @RequestDec(decType = "decBody")
    public Map dec(@RequestBody Map data){
        return data;
    }


    @PostMapping("encReq")
    @ResponseEnc(encType = "encReq")
    public Map encReq(@RequestBody Map data){
        return data;
    }


    @GetMapping("decReq")
    @RequestDec(decType = "decReq")
    public String encReq(@RequestParam("name") String name,@RequestParam("say") String say){
        return String.format("%s say:%s",name,say);
    }
}
